#include <iostream>
#include <signal.h>
#include <unistd.h>
//#include <sigaction.h>

using namespace std;

void sigcb(int signum)
{
    cout << "捕获到一个信号：" << signum << endl;
}

int main()
{
    struct sigaction act,oact;
    act.sa_flags = 0;
    sigemptyset(&act.sa_mask);
    act.sa_handler = sigcb;

    sigaction(2,&act,&oact);
    
    cout << "defalut action:" << (int)(oact.sa_handler) << endl;
    

    while(1) sleep(1);
    return 0;
}
